Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram, initial language setup (for future changes in frontend), don't remove last buy when under amount, reworked notifications. #204

Closed

Conversation

pedrohusky
Copy link
Contributor

@pedrohusky pedrohusky commented May 28, 2021

Right now it has:

-Telegram notifications;
-Don't remove last buy when under X amount (minimum 1);
-Reworked notifications to be readable in telegram and slack.
-I've added a language switch to receive the updates in one of the two current languages (enUS and ptBR).
-It should spam less checking buy.

SETUP TELEGRAM:

To setup telegram, you just need to edit .env file and fill the form. The bot you can create talking with @Botfather in telegram and he will tell the steps to do.
The chat_ID you can get by talking with @userinfobot.

Motivation and Context

Those changes was required by a lot of people in discord and telegram. It solves the problem that the bot would loose its last price, the coin drops and the bot buys more. Then it sells every coin bought at the last coin bough profit.

Telegram is necessary, not everyone uses slack.

I've reworked the messages to be more readable for the user. It is a work in progress. It will be polished later.

Multilanguage is very appreciated by everyone. :)

How Has This Been Tested?

I've tested the notifications from telegram, the last buy price is working 100% (the bot removes when it sell successfully), and the notification language too.

Screenshots (if appropriate):

-- This is using the ptBR language!
Captura de Tela (11)
Captura de Tela (10)

Right now it has:

 -Telegram notifications;
 -Don't remove last buy when under X amount (minimum 1);
 -Reworked notifications to be readable in telegram and slack.
 -I've added a language switch to receive the updates in one of the two current languages (enUS and ptBR).
 -It should spam less checking buy.

To setup telegram, you just need to edit .env file and fill the form. The bot you can create talking with @Botfather in telegram and he will tell the steps to do.
The chat_ID you can get by talking with @userinfobot.

Thanks. I'll open a push request.
@pedrohusky pedrohusky changed the title Telegram, initial language setup (for future changes in frontend), reworked notifications. Telegram, initial language setup (for future changes in frontend), don't remove last buy when under amount, reworked notifications. May 28, 2021
@chrisleekr
Copy link
Owner

chrisleekr commented May 29, 2021

Hey,

Thanks for your contributions. This is pretty good.

It looks like you try to cover two features:

  • Remove the last buy price when it is under configured amount. #190
  • Improve notificaitons. #106

Again that is awesome, thanks for that.

However, I see some issues with your PR.

General:

  • Too many changes for a single PR. Since I am the one who should review the changes, it's kind of troublesome to see massive changes for multiple features. I understand notification changes are pretty big, but removing the last buy price is pretty small. Can you separate PR to each feature?
  • All changes must be written with the test. I see lots of failing when I run npm run test.

Remove the last buy price when it is under configured amount:

Improve notificaitons:

  • I understand the current Slack message is quite long, which there is a reason for that. The bot itself generates a massive log to make sure it runs correctly. It's not possible to trace with the log because they are just too much. I am using Slack to trace/debug the issues when I couldn't see the log. It must be improved as you said, it is too long and spamming. At this point, simply reducing the content of the message won't be helpful to debug what happened with the trade. To improve the notification, it first needs to find a way to record debug messages so we can trace later on whether the bot was working as expected or not.
  • I understand you need Telegram notification because it's your main messenger. If you see issue Notifications #106, someone suggested Apprise, which can support multiple services. So my idea is rather than supporting a single extra notification service (because others may need another service), research about this notification service might be a good idea.
  • In addition to Apprise, the notification type must be selected. For example, if I select to receive buy/sell action results, then it should only send those notifications.
  • little typo alert (messager -> messenger)

I appreciate your effort for the PR, let's continue to discuss.

@pedrohusky
Copy link
Contributor Author

pedrohusky commented May 29, 2021

  • Too many changes for a single PR. Since I am the one who should review the changes, it's kind of troublesome to see massive changes for multiple features. I understand notification changes are pretty big, but removing the last buy price is pretty small. Can you separate PR to each feature?

Of course! Sorry for that. It was the replace all fault. I needed to replace every 'slack' reference and then it changed even the .test files. I will separate them.

Remove the last buy price when it is under configured amount:

Sure! I didn't think about that. I thought the symbols would save the last amount when we changed. But they don't. I will do that!

Improve notificaitons:

  • I understand the current Slack message is quite long, which there is a reason for that. The bot itself generates a massive log to make sure it runs correctly. It's not possible to trace with the log because they are just too much. I am using Slack to trace/debug the issues when I couldn't see the log. It must be improved as you said, it is too long and spamming. At this point, simply reducing the content of the message won't be helpful to debug what happened with the trade. To improve the notification, it first needs to find a way to record debug messages so we can trace later on whether the bot was working as expected or not.

And if the bot send the debug message as a .txt file through telegram (don't know if slack support it) ? It would be readable and we can even open the file to see what gone wrong.

  • little typo alert (messager -> messenger)

Kkk, sorry for the messager 😞. I will rename it. It was my fault.

  • I understand you need Telegram notification because it's your main messenger. If you see issue Notifications #106, someone suggested Apprise, which can support multiple services. So my idea is rather than supporting a single extra notification service (because others may need another service), research about this notification service might be a good idea.

I will study apprise to implement it. Thanks for the head's up.

  • In addition to Apprise, the notification type must be selected. For example, if I select to receive buy/sell action results, then it should only send those notifications.

Oh. Again, didn't tought about that. Sure I will implement the notification options!

I appreciate your effort for the PR, let's continue to discuss.

I'm very happy to help. Thanks, again and sorry for the newbie mistakes. ❤️

@chrisleekr
Copy link
Owner

chrisleekr commented May 29, 2021

@pedrohusky 👍

I'm very happy to help. Thanks, again and sorry for the newbie mistakes. heart

No problem. Please don't be sorry. It's always welcome to get any contributions. :)

FYI, I just edited my last message. Just in case you missed.

All changes must be written with the test. I see lots of failing when I run `npm run test.`

@pedrohusky
Copy link
Contributor Author

@pedrohusky 👍

I just edited my last message. Just in case you missed.

All changes must be written with the test. I see lots of failing when I run `npm run test.`

Sorry, didn't know that. I will fix it asap. Didn't know the test files was useful. Now I know. Sorry. They are giving failure because I didn't fix the slack replace in them.

@chrisleekr
Copy link
Owner

@pedrohusky

Yeah, writing tests are a horrible experience, but if I also find lots of my mistakes by writing the tests.
It helps to make sure your code runs as expected.

@chrisleekr
Copy link
Owner

@pedrohusky Btw, for the language code, please follow ISO language code - https://www.andiamo.co.uk/resources/iso-language-codes/

@pedrohusky
Copy link
Contributor Author

Btw, for the language code, please follow ISO language code - https://www.andiamo.co.uk/resources/iso-language-codes/

@chrisleekr sure! I'm making some changes right now. :)

Edited the .test files to their original state.
Messager is now messenger.
Last buy threshold now is like max purchase amount, thanks @chrisleekr
@pedrohusky
Copy link
Contributor Author

pedrohusky commented May 29, 2021

@chrisleekr

Hi! I've made the last buy threshold work like max purchase amount, the language now follows the ISO standard.

How to work with test files? I only get this:

[email protected] test
cross-env NODE_ENV=test jest --coverage --detectOpenHandles

sh: 1: cross-env: not found

Don't know what to do.

I still don't know how what to do with apprise, will look more into it. Could you please point me a direction?

@chrisleekr
Copy link
Owner

Closed in favour of #206

@chrisleekr chrisleekr closed this May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants